<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" template="../../index.xhtml"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:f="http://xmlns.jcp.org/jsf/core">


    <ui:define name="content">
        <h:form>
            <!--Desenvolver listagem de processamento-->

            <p:growl id="grow"
                     showDetail="true"
                     sticky="false"/>

            <div align="center">
                <h:panelGrid width="800" >
                    <p:panel id="panel" header="Processamentos">
                        <p:dataTable var="process" value="#{processamentoBeans.processamentos}" 
                                     rows="5" paginator="true" id="bars"
                                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                     rowsPerPageTemplate="6,12,16">

                            <p:column headerText="Código">
                                <div align="center"><h:outputText value="#{process.id}"/></div>
                            </p:column>

                            <p:column headerText="Batedor">
                                <h:outputText value="#{process.batedor.nome}"/>
                            </p:column>

                            <p:column headerText="Data">
                                <h:outputText value="#{process.data}">
                                    <f:convertDateTime pattern="dd/MM/yyyy"/>
                                </h:outputText>
                            </p:column>

                            <p:column headerText="Quantidade">
                                <h:outputText value="#{process.quantidade}"/>
                            </p:column>

                            <p:column headerText="Cesto">
                                <h:outputText value="#{process.cestodistribuidor.capacidade}"/>
                            </p:column>

                            <p:column headerText="Categoria">
                                <h:outputText value="#{process.categoria.nome}"/>
                            </p:column>

                            <p:column headerText="Operações">
                                <div align="center">
                                    <p:commandButton
                                        ajax="false"
                                        icon="ui-icon-pencil"
                                        action="#{processamentoBeans.editar()}">
                                        <f:setPropertyActionListener
                                            target="#{processamentoBeans.processamentos}"
                                            value="#{process}"/>
                                    </p:commandButton>

                                    <p:commandButton
                                        ajax="false"
                                        icon="ui-icon-trash"
                                        action="#{processamentoBeans.excluir()}">
                                        <f:setPropertyActionListener
                                            target="#{processamentoBeans.processamentos}"
                                            value="#{process}"/>
                                    </p:commandButton>
                                </div>
                            </p:column>
                        </p:dataTable>
                    </p:panel>
                </h:panelGrid>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
